home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
ScrollableViewEditor.cpp
< prev
next >
Wrap
Text File
|
1997-08-26
|
4KB
|
148 lines
/*
* File: ScrollableViewEditor.cpp
* Summary: A view that knows how to edit a TScrollableView.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 12/07/96 JDJ Created
*/
#include "ScrollableViewEditor.h"
#include <ZControl.h>
#include <ZTextBox.h>
// ===================================================================================
// class CEditScrollableViewCommand
// ===================================================================================
//---------------------------------------------------------------
//
// CEditScrollableViewCommand::~CEditScrollableViewCommand
//
//---------------------------------------------------------------
CEditScrollableViewCommand::~CEditScrollableViewCommand()
{
}
//---------------------------------------------------------------
//
// CEditScrollableViewCommand::CEditScrollableViewCommand
//
//---------------------------------------------------------------
CEditScrollableViewCommand::CEditScrollableViewCommand(TScrollableView* pane, const SScrollableViewInfo& oldInfo, const SScrollableViewInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
{
}
//---------------------------------------------------------------
//
// CEditScrollableViewCommand::UpdatePane
//
//---------------------------------------------------------------
void CEditScrollableViewCommand::UpdatePane(const SScrollableViewInfo& info)
{
mPane->SetScrollUnits(info.units);
mPane->SetReconcileOverhang(info.reconcileOverhang);
mPane->SetAdjustOrigin(info.adjustOrigin);
}
#pragma mark -
// ===================================================================================
// CScrollableViewEditor
// ===================================================================================
static TReanimatorRegister<CScrollableViewEditor> sScrollableEditorRegistrar;
//---------------------------------------------------------------
//
// CScrollableViewEditor::~CScrollableViewEditor
//
//---------------------------------------------------------------
CScrollableViewEditor::~CScrollableViewEditor()
{
}
//---------------------------------------------------------------
//
// CScrollableViewEditor::CScrollableViewEditor
//
//---------------------------------------------------------------
CScrollableViewEditor::CScrollableViewEditor(TView* superView) : Inherited(superView)
{
}
//---------------------------------------------------------------
//
// CScrollableViewEditor::Create [static]
//
//---------------------------------------------------------------
MReanimatable* CScrollableViewEditor::Create(MReanimatable* parent)
{
return new CScrollableViewEditor(dynamic_cast<TView*>(parent));
}
//---------------------------------------------------------------
//
// CScrollableViewEditor::GetEditorInfo
//
//---------------------------------------------------------------
SScrollableViewInfo CScrollableViewEditor::GetEditorInfo() const
{
SScrollableViewInfo info;
TTextBox* textBox = nil;
TControl* control = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Horz Units"));
info.units.width = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Vert Units"));
info.units.height = textBox->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Reconcile Overhang"));
info.reconcileOverhang = control->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Adjust Origin"));
info.adjustOrigin = control->GetValue();
return info;
}
//---------------------------------------------------------------
//
// CScrollableViewEditor::SetEditorInfo
//
//---------------------------------------------------------------
void CScrollableViewEditor::SetEditorInfo(const SScrollableViewInfo& info)
{
TTextBox* textBox = nil;
TControl* control = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Horz Units"));
textBox->SetValue(info.units.width);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Vert Units"));
textBox->SetValue(info.units.height);
control = dynamic_cast<TControl*>(this->FindSubPane("Reconcile Overhang"));
control->SetValue(info.reconcileOverhang);
control = dynamic_cast<TControl*>(this->FindSubPane("Adjust Origin"));
control->SetValue(info.adjustOrigin);
}